
package com.gitee.jmash.storage.entity;


import com.gitee.jmash.core.orm.jpa.entity.*;
import com.gitee.jmash.storage.entity.StorageOrganBrowserEntity.StorageOrganBrowserPk;
import jakarta.json.bind.annotation.JsonbDateFormat;
import jakarta.json.bind.annotation.JsonbTransient;
import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.Id;
import jakarta.persistence.IdClass;
import jakarta.persistence.Lob;
import jakarta.persistence.Table;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;
import jakarta.persistence.Transient;
import jakarta.persistence.Version;
import jakarta.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.math.BigDecimal;
import java.util.Objects;
import java.util.UUID;


 /**
 * storage 组织浏览信息表 .
 *
 * @author <a href="mailto:service@crenjoy.com">crenjoy</a>
 */
@Entity
@Table(name = "storage_organ_browser")
@IdClass(StorageOrganBrowserPk.class)
public class StorageOrganBrowserEntity  implements Serializable  {

  private static final long serialVersionUID = 1L;
  
  /** 组织ID. */
  private UUID organId= UUID.randomUUID()  ;
  /** 统一身份ID. */
  private String unifiedId ;
  /** 服务类型. */
  private String serviceType ;
  /** 最近浏览时间. */
  private LocalDateTime lastBrowseTime=LocalDateTime.now() ;
  /** 浏览次数. */
  private Integer browseCount = 1 ;

  /**
  * 默认构造函数.
  */
  public StorageOrganBrowserEntity(){
    super();
  }

  public StorageOrganBrowserEntity(StorageOrganBrowserPk pk) {
    super();
    this.serviceType=pk.getServiceType();
    this.unifiedId=pk.getUnifiedId();
    this.organId=pk.getOrganId();
  }
  
  /** 实体主键. */
  @Transient
  @JsonbTransient
  public StorageOrganBrowserPk  getEntityPk(){
    StorageOrganBrowserPk pk=new StorageOrganBrowserPk();
    pk.setServiceType(this.serviceType);
    pk.setUnifiedId(this.unifiedId);
    pk.setOrganId(this.organId);
    return pk;
  }
  /** 实体主键. */
  public void setEntityPk(StorageOrganBrowserPk  pk){
    this.serviceType=pk.getServiceType();
    this.unifiedId=pk.getUnifiedId();
    this.organId=pk.getOrganId();
  }
  
   /** 组织ID(OrganId). */
  @Id
  @Column(name="organ_id",nullable = false,columnDefinition = "BINARY(16)")
  public UUID getOrganId() {
    return organId;
  }
  /** 组织ID(OrganId). */
  public void setOrganId(UUID organId) {
    this.organId = organId;
  }
   /** 统一身份ID(UnifiedId). */
  @Id

  @Column(name="unified_id",nullable = false)
  public String getUnifiedId() {
    return unifiedId;
  }
  /** 统一身份ID(UnifiedId). */
  public void setUnifiedId(String unifiedId) {
    this.unifiedId = unifiedId;
  }
   /** 服务类型(ServiceType). */
  @Id

  @Column(name="service_type",nullable = false)
  public String getServiceType() {
    return serviceType;
  }
  /** 服务类型(ServiceType). */
  public void setServiceType(String serviceType) {
    this.serviceType = serviceType;
  }
   /** 最近浏览时间(LastBrowseTime). */

  @Column(name="last_browse_time",nullable = false)
  public LocalDateTime getLastBrowseTime() {
    return lastBrowseTime;
  }
  /** 最近浏览时间(LastBrowseTime). */
  public void setLastBrowseTime(LocalDateTime lastBrowseTime) {
    this.lastBrowseTime = lastBrowseTime;
  }
   /** 浏览次数(BrowseCount). */
  @Column(name="browse_count")
  public Integer getBrowseCount() {
    return browseCount;
  }
  /** 浏览次数(BrowseCount). */
  public void setBrowseCount(Integer browseCount) {
    this.browseCount = browseCount;
  }
	
  @Override
  public int hashCode() {
    return Objects.hash(   serviceType   ,  unifiedId   ,  organId );
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj) {
      return true;
    }
    if (obj == null) {
      return false;
    }
    if (getClass() != obj.getClass()) {
      return false;
    }
	
    StorageOrganBrowserEntity other = (StorageOrganBrowserEntity) obj;
	
	return   Objects.equals(serviceType, other.serviceType)    &&  Objects.equals(unifiedId, other.unifiedId)    &&  Objects.equals(organId, other.organId)   ;
  }
  
  
  /**
   * StorageOrganBrowserPK（直接对应数据库的配置 由生成工具产生）.
   *
   * @author <a href="mailto:service@crenjoy.com">crenjoy</a>
   */
  @Embeddable
  public static class StorageOrganBrowserPk implements Serializable{
  
    private static final long serialVersionUID = 1L;
    
    /** 服务类型. */
    @NotNull
    private String serviceType;
    /** 统一身份ID. */
    @NotNull
    private String unifiedId;
    /** 组织ID. */
    @NotNull
    private UUID organId;
    
    /** 服务类型(ServiceType). */
	@Column(name="service_type",nullable = false)
    public String getServiceType() {
      return serviceType;
    }
    
    /** 服务类型(ServiceType). */
    public void setServiceType(String serviceType) {
      this.serviceType = serviceType;
    }
    /** 统一身份ID(UnifiedId). */
	@Column(name="unified_id",nullable = false)
    public String getUnifiedId() {
      return unifiedId;
    }
    
    /** 统一身份ID(UnifiedId). */
    public void setUnifiedId(String unifiedId) {
      this.unifiedId = unifiedId;
    }
    /** 组织ID(OrganId). */
	@Column(name="organ_id",nullable = false)
    public UUID getOrganId() {
      return organId;
    }
    
    /** 组织ID(OrganId). */
    public void setOrganId(UUID organId) {
      this.organId = organId;
    }
      
    @Override
    public int hashCode() {
      return Objects.hash(   serviceType   ,  unifiedId   ,  organId );
    }
  
    @Override
    public boolean equals(Object obj) {
      if (this == obj){
        return true;
      }
      if (obj == null){
        return false;
      }
      if (getClass() != obj.getClass()){
        return false;
      }
      StorageOrganBrowserPk other = (StorageOrganBrowserPk) obj;
      return   Objects.equals(serviceType, other.serviceType)    &&  Objects.equals(unifiedId, other.unifiedId)    &&  Objects.equals(organId, other.organId)   ;
    }
  }

}
